<template>
	<view class="" >

		<view class="con-body wrap">
			<view style="background: url('https://vkceyugu.cdn.bspapp.com/VKCEYUGU-weitao/2d0ca750-0e3d-11eb-b244-a9f5e5565f30.png') no-repeat center / 100% 80%; background-position: top;">
				<u-cell-group :border="false">
					<view class="card-head">
						<u-cell :border="false">
							<view slot="icon">
								<u-avatar :src="user.avatar" size="90" mode="aspectFill"></u-avatar>
							</view>
							<view slot="label" style="margin-left: 10rpx;">
								<view>
									<text style="font-size: 32rpx;">{{user.username}}</text>
								</view>
								<view style="margin-top: 15rpx;">
				
									<text style="font-size: 28rpx; color: #FFFFFF;">{{user.userid}}</text>
								</view>
							</view>
						</u-cell>
					</view>
				
				</u-cell-group>
				
				<view style="margin-top: 20rpx; border-radius: 20rpx;background-color: #fefefe; width: 96%; margin-left: 2%;">
				
					<view class="iconType" @click="myorder"><text style="margin-top: 10rpx; font-size: 32rpx; font-weight: bold;">全部订单</text>
					</view>
					<view class="iconType">
						<u-line></u-line>
					</view>
					<view class="iconType">
						<view class="item">
							<view class="icon" @click="myorder">
								<u-icon size="40" name="/static/user/shouhou.png"></u-icon>
							</view>
							待付款
						</view>
						<view class="item">
							<view class="icon" @click="myorder">
								<u-icon size="40" name="/static/user/daishouhuo.png"></u-icon>
							</view>
							待发货
						</view>
						<view class="item">
							<view class="icon" @click="myorder">
								<u-icon size="40" name="/static/user/daifukuan.png"></u-icon>
							</view>
							待收货
						</view>
						<view class="item">
							<view class="icon" @click="myorder">
								<u-icon size="40" name="/static/user/daipingjia.png"></u-icon>
							</view>
							待评价
						</view>
						<!-- <view class="item">
							<view class="icon" @click="myorder">
								<u-icon size="40" name="/static/user/shouhou.png"></u-icon>
							</view>
							退款/售后
						</view> -->
					</view>
				</view>
			</view>
			

			<view class="caozuo_list">
				<u-cell-group style="margin-top: 10rpx;" :border="false">
					<u-cell :border="false" isLink @click="toaddress" icon="https://resourse.cnlhjt.com/upload/20220825/0ee09e658a64991693a043596c170c88.png"
						title="收货地址"></u-cell>
					<u-cell :border="false" isLink @click="toservice" icon="https://resourse.cnlhjt.com/upload/20220825/9c75f79427952695dee93b0dccaff72a.png"
						title="官方客服"></u-cell>
					<u-cell :border="false" isLink @click="tosetting" icon="https://resourse.cnlhjt.com/upload/20220825/a196b14d5cb0bf46975ac71b2421ce2f.png"
						title="设置"></u-cell>
				</u-cell-group>
			</view>

		</view>

	</view>
</template>

<script>
	import { getInfo } from "@/service/userService.js";
	export default {
		data() {
			return {
				user: {
					avatar: 'https://img2.baidu.com/it/u=3716715980,137628655&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
					username: '您好！请登录！',
					userid: '请登陆您的账户',
					level: 0,
					type: 0,
				}
			}
		},
		mounted(){
			if(this.$store.state.isLogin == true){
				this.isLogin = true;
				this.user = {
					avatar: this.$store.state.avatar,
					username: this.$store.state.username,
					userid: this.$store.state.userid,
					level: this.$store.state.level,
					type: this.$store.state.userType,
					// home: this.$store.state.home
				}
				getInfo().then(this.getInfo);
			}
			
		},
		methods: {
			getInfo(e){
				if(e.code == 200){
					this.user.avatar=e.result.avatar;
					this.user.username=e.result.username;
					
				}
			},
			tosetting(){
				uni.navigateTo({
					url:'/pagesShop/mine/setting'
				})
			},
			toaddress(){
				uni.navigateTo({
					url:'/pagesShop/mine/address'
				})
			},
			myorder(){
				uni.navigateTo({
					url:'/pagesShop/order/order'
				})
			},
			toservice(){
				uni.navigateTo({
					url:'/pagesShop/mine/service'
				})
			}
		}
	}
</script>

<style lang="scss">
	.caozuo_list{
		margin-top: 20rpx; 
		background-color: #fefefe; 
		border-radius: 20rpx; 
		width: 96%; 
		margin-left: 2%;
		box-shadow: 5rpx 5rpx 20rpx rgba(0,0,0,0.15);
	}
	.wrap {
		width: 100%;
		margin-left: 0%;
		margin-bottom: 44rpx;
	}

	.card-head {
		border-radius: 20rpx;
	}

	.iconType {
		display: flex;
		padding: 10rpx 40rpx;
		justify-content: space-between;
	}

	.icon {
		height: auto;
	}

	.item {
		display: flex;
		flex-direction: column;
		align-items: center;
		font-size: 28rpx;
		color: #666666;
	}
</style>
